import React, { useEffect } from "react"
import { Select } from "antd"
import { getLanguageData, changeLanguage, getLanguage } from "@/lang/index"
const Index = () => {
  // 切换语言的方法
  const handelLanguage = (val: string) => {
    changeLanguage(val)
  }
  return (
    <div>
      <Select
        defaultValue={getLanguage()}
        style={{ width: 120 }}
        onChange={handelLanguage}
        options={getLanguageData().map(item => {
          return {
            value: item.code,
            label: item.name,
          }
        })}
      />
    </div>
  )
}

export default Index
